#include"ProcessPool.hpp"
void Usage(std::string proc)
{
    std::cout << "usage: " << proc << " process-nums" << std::endl;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        return USAGEERROR;
    }
    int num = std::stoi(argv[1]);
    ProcessPool *pp = new ProcessPool(num,Worker);
    pp->InitProcessPoll();
    pp->DispatchTask();
    pp->CleanProcessPool();
    //InitProcessPoll(num, channels, Worker);
    // DbugPrint(channels);
    //DispatchTask(channels);
    //CleanProcessPool(channels);
    // if (n == 0)
    // {
    //     std::cout << "fds[0]" << fds[0] << std::endl;
    //     std::cout << "fds[1]" << fds[1] << std::endl;
    // }
    // std::cout << "father wait child success: " << rid << std::endl;
    delete pp;
    return 0;
}